package com.alstudio.module.sns.weiboshare;

import wxapi.WeiXin;
import wxapi.WeiXinShareDialog;
import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;

public class WeiXinShare implements IWeiboShare {

	private WeiXin mWeiXin;
	private Activity mActivity;
	private Callback mCallback;
	private String mImageUrl;
	private String mImageFile;

	public WeiXinShare() {
//		mWeiXin = ThirdPartFactory.getWeiXinInstance();
	}

	@Override
	public void authorize(Activity activity, Callback callback) {
		mActivity = activity;
		mCallback = callback;
		if (callback != null) {
			callback.onSuccess(IWeiboShare.ACTION_AUTHORIZE);
		}
	}
	
	public WeiXin getWeixinInstance(Callback callback){
		mWeiXin = ThirdPartFactory.getWeiXinInstance();
		mWeiXin.callback = callback;
		return mWeiXin;
	}

	@Override
	public void share(Activity activity, String content, String imageFile,
			boolean isAddLoovee, Callback callback) {

		if (!TextUtils.isEmpty(imageFile)) {

		}
		mWeiXin = ThirdPartFactory.getWeiXinInstance();
		mWeiXin.callback = callback;
		WeiXinShareDialog.showDialog(activity, content,imageFile, mWeiXin);
	}

	@Override
	public void shareWithImageUrl(Activity activity, String content,
			String imageUrl, boolean isAddLoovee, Callback callback) {
		if (TextUtils.isEmpty(imageUrl)) {
			imageUrl = WeiboShareUtil.getDefaultLooveeAppLogoUrl();
		}
		mWeiXin = ThirdPartFactory.getWeiXinInstance();
		mWeiXin.callback = callback;
		WeiXinShareDialog.showDialog(activity,content, imageUrl, mWeiXin);
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		
	}

	@Override
	public void getFriends(Activity activity, Callback callback) {
		// TODO Auto-generated method stub
		
	}
	
	public static void shareToWeixinNormal(Activity activity, String content, String imageFile){
		WeiXinShareDialog.shareToWeixinNormal(ThirdPartFactory.getWeiXinInstance(), activity, content, imageFile);
	}

	
}
